\chapter{Existing Implementations}
\label{chp:existingimp}
\lhead{Chapter \ref{chp:existingimp}. \emph{Existing Implementations}}

Before work was started on the proposed software Bluetooth stack implementation, the existing field of Bluetooth stacks (both commercial and non-commercial) were evaluated to determine what the market currently offers.

\section{Classes of Existing Stacks}

During the course of the project background research into existing Bluetooth stacks, two distinct classes of stack were observed, each with distinct assumptions and capabilities:

\begin{itemize}
	\item \textbf{Operating System based Stacks}, which assumed that they would be run on top of a complex full-featured OS, containing a kernel- and user-space, virtualized memory, synchronisation primitives, etc.
	\item \textbf{Embedded Stacks}, which assumed no OS was present, but nevertheless made assumptions as to the environment's capabilities for dynamic memory allocation
\end{itemize}

These two classes of stacks show two possible approaches to an implementation; one, the designer may write a stack around an existing Operating System API, or two, the designer can assume a ``freestanding'' or ``bare metal'' environment, with either no, or only a minimal, RTOS being present.

\section{Existing Bluetooth Stacks}

Below the discovered existing Bluetooth stacks are listed in parametric form for each class of stack for ease of reference.

\subsection{Operating System Stacks}

\begin{table}[H]
	\begin{center}
		\begin{tabular}{ | l | l | l |}
			\hline
			\textbf{Stack Name}	& \textbf{Operating System}	& \textbf{Commercial} \\ \hline

			FreeBSD Stack		& FreeBSD	& No	\\ \hline
			Affix Stack			& Linux		& No	\\ \hline
			BlueZ Stack			& Linux		& No	\\ \hline
			Apple Stack			& MacOS		& Yes	\\ \hline
			BlueFritz! Stack	& Windows	& Yes	\\ \hline
			CSR Harmony Stack	& Windows	& Yes	\\ \hline
			FreeBT Stack 		& Windows	& No	\\ \hline
			Microsoft Stack		& Windows	& Yes	\\ \hline
			Toshiba Stack		& Windows	& Yes	\\ \hline
			Widcomm Stack		& Windows	& Yes	\\ \hline
		\end{tabular}
		\caption[Existing operating system Bluetooth stacks]{Parametric table of existing OS based Bluetooth stacks.}
		\label{tab:osbtstacks}
	\end{center}
\end{table}

As expected, the vast majority of existing OS based Bluetooth stacks are targeted towards the Microsoft Windows operating system, due to its large market share. In almost all cases, the existing stacks were found to support a rich number of Bluetooth services, in both device and server roles. While the majority of the Bluetooth stacks on the market are commercialized (i.e. require payment or hardware purchase for a license to use them) there are still several free and open source stacks available for the various Linux and BSD kernels.

\subsection{Embedded Stacks}

\begin{table}[H]
	\begin{center}
		\begin{tabular}{ | l | l |}
			\hline
			\textbf{Stack Name}	& \textbf{Commercial} \\ \hline

			BlueCode+ Stack		& Yes	\\ \hline
			BlueLet Stack		& Yes	\\ \hline
			BlueMagic Stack		& Yes	\\ \hline
			Bluetopia Stack		& Yes	\\ \hline
			BTStack Stack		& No	\\ \hline
			ClarinoxBlue Stack	& Yes	\\ \hline
			CSR Synergy Stack	& Yes	\\ \hline
			EtherMind Stack		& Yes	\\ \hline
			Jungo BTware Stack	& Yes	\\ \hline
			lwBT Stack			& No	\\ \hline
			Mecel Betula Stack	& Yes	\\ \hline
			Symbian OS Stack	& Yes	\\ \hline
		\end{tabular}
		\caption[Existing embedded Bluetooth stacks]{Parametric table of existing embedded Bluetooth stacks.}
		\label{tab:embbtstacks}
	\end{center}
\end{table}

Contrasting with the OS based stacks discussed previously, almost all Bluetooth stacks aimed at the embedded market today were found to be exclusively commercialized, requiring large payments and license agreements before they could be integrated into existing designs. Of note in this area are the \textit{BTStack} and \textit{lwBT} embedded Bluetooth stacks, which were both found to be both free and open source, but suffered from the constraints of RTOS dependencies in the case of the former, and incompleteness in the case of the latter.
